{extend name="./theme/backend/base.html"}
{block name="content"}
<script>
	$(function(){
		$("[data-toggle='tooltip']").tooltip();
	});
</script>
<style type="text/css">.selector{width: 120px;}</style>
<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('cms/posts/index')}">文章管理</a></li>
			<li><a href="{:url('cms/posts/add')}">添加文章</a></li>
		</ul>
		<form class="well form-search" method="get" action="">
			<input type="hidden" name="act" value="search" />
			分类：
			<select name="cateid" class="selector category">
				<option value="0">全部</option>
				{$categorys|default=""} 
			</select> &nbsp;&nbsp;
			<select name="ischeck" class="selector ischeck">
				<option value="">审核状态</option>
				<option value="0">未审核</option>
				<option value="1">已审核</option>
			</select> &nbsp;&nbsp;
			时间：
			<input type="text" name="start_time" class="js-datetime date" value="{$search.start_time|default=''}" style="width: 120px;" autocomplete="off">-
			<input type="text" class="js-datetime date" name="end_time" value="{$search.end_time|default=''}" style="width: 120px;" autocomplete="off"> &nbsp; &nbsp;
			关键字： 
			<input type="text" name="keyword" style="width: 200px;" value="{$search.keyword|default=''}" placeholder="请输入关键字...">
			<input type="submit" class="btn btn-primary" value="搜索">
			<a class="btn btn-danger" href="{:url('cms/posts/index')}">清空</a>
		</form>
		
		<form method="post" class="js-ajax-form" action="term/listorders">
			<div class="table-actions">
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/check',['ischeck'=>1])}" data-subcheck="true">审核
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/check',['ischeck'=>0])}" data-subcheck="true">取消审核
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/Settop',['istop'=>1])}" data-subcheck="true">置顶
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/Settop',['istop'=>0])}" data-subcheck="true">取消置顶
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/setRec',['isrecommend'=>1])}" data-subcheck="true">推荐
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/setRec',['isrecommend'=>0])}" data-subcheck="true">取消推荐
	            </button>
	            <!--
	            <button class="btn btn-primary btn-small js-articles-copy" type="button">批量复制</button>
	            -->
	            <button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/del')}" data-subcheck="true" data-msg="您确定删除吗？">删除</button>
	        </div>
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="15">
							<label>
								<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
							</label>
						</th>
						<th width="10">ID</th>
						<th>文章标题</th>
						<th width="60">所属分类</th>
						<th>浏览量/评论</th>
						<th>来源</th>
						<th>缩略图</th>
						<th>作者</th>
						<th>发布时间</th>
						<th width="60">状态</th>
						<th width="80">操作</th>
					</tr>
				</thead>
				<tbody>
					{empty name="list"}
					<td colspan="11">没有数据</td>
					{else/}
					{foreach name="list" item="vo"}
					<tr>
						<td>
							<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="id[]" value="{$vo.id}" title="ID:{$vo.id}">
						</td>
						<td>{$vo.id}</td>
						<td><a href="{:url('frontend/Posts/show',['id'=>$vo.id])}" target="_blank">{$vo.title}{notempty name="$vo.short_link"} (<span class="red">{$vo.short_link}</span>){/notempty}</a></td>
						<td><a href="{:url('cms/posts/index',['act'=>'search','cateid'=>$vo.cateid])}">{$vo.ctitle}</a></td>
						<td>{$vo.view} / {$vo.comments_number|default=0}</td>
						<td>{$vo.source}</td>
						<td>
							{empty name="vo.thumb"}
								<i class="fa fa-close fa-fw"></i>
							{else/}
								<img src="{$vo.thumb}" style="max-height:80px;max-width:100px;margin:auto;"/>
							{/empty}
						</td>
						<td>{$vo.author}</td>
						<td>{$vo.datetime|date="Y-m-d H:i:s",###}</td>
						<td>

							{eq name="vo.ischeck" value="1"}
                        	<img src="/data/assets/images/btn_enable.png" title="已审核" class="ajax-status" data="Posts|ischeck|id|{$vo.id}" action="{:url('cms/Posts/ajaxdata')}"/>
                        	{else/}
                        	<img src="/data/assets/images/btn_disable.gif" title="未审核" class="ajax-status" data="Posts|ischeck|id|{$vo.id}" action="{:url('cms/Posts/ajaxdata')}"/>
                        	{/eq}
                        	<br/>
							{if condition="$vo.istop eq 1"}置顶<br/>{/if}
							{if condition="$vo.isrecommend eq 1"}推荐{/if}
						</td>
						<td>
							<a href="javascript:;" data-url="{:url('cms/posts/edit',['parentid'=>$vo['cateid'],'cid'=>$vo['id']])}" class="layer-edit" data-title="修改{$vo.title}">修改</a> |
							<a href="{:url('cms/posts/del',['id'=>$vo['id']])}" class="js-ajax-delete">删除</a>
						</td>
					</tr>
					{/foreach}
					{/empty}
				</tbody>
			</table>
			<div class="table-actions">
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/check',['ischeck'=>1])}" data-subcheck="true">审核
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/check',['ischeck'=>0])}" data-subcheck="true">取消审核
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/Settop',['istop'=>1])}" data-subcheck="true">置顶
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/Settop',['istop'=>0])}" data-subcheck="true">取消置顶
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/setRec',['isrecommend'=>1])}" data-subcheck="true">推荐
	            </button>
	            <button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/setRec',['isrecommend'=>0])}" data-subcheck="true">取消推荐
	            </button>
	            <button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:url('cms/posts/del')}" data-subcheck="true" data-msg="您确定删除吗？">删除</button>
	        </div>
			{notempty name="list"}
				<div class="pagination text-center">{$list->render()}</div>
			{/notempty}
		</form>
	</div>
<script src="{$admin_assets_path}/js/common.js"></script>
<script type="text/javascript">
$(".category").val("{$search.cateid|default=0}");
$(".ischeck").val("{$search.ischeck|default=''}");
</script>
{/block}